<?php
namespace Api\Controller;
use Api\Controller\CommonController;
class CategoryController extends CommonController {
    public function index(){
		
    }
    
    public function categoryList(){
		//isset($_POST['level'])?$level =intval($_POST['level']):$level=0;
		isset($_POST['parent'])?$parent =intval($_POST['parent']):$parent=0;
		isset($_POST['type'])?$type =intval($_POST['type']):$type=1;
		
		$where = array();
		/*if($level!=0){
			$where['level'] = $level;
		}*/
		$where['type'] = $type;
		
		if($parent!=0){
			$where['parent'] = $parent;
		}
		$list = D("Category")->where($where)->order('sort')->select();
		$all = array('categoryID'=>'0','name'=>'全部','parentID'=>'0','sort'=>'-1');
		array_unshift($list, $all);
    	$this->_returnJson(array("result"=>1,"list"=>$list));
    }
    
    
}